import { defineStore } from "pinia";
import { computed, ref } from "vue";

export const useCounterStore = defineStore('counter', () => {
    const count = ref<number>(0) // pinia的state属性

    // function就是pinia的actions
    const increment = () => {
        count.value++
    }

    // computed就是pinia的getters
    const doubleCount = computed(() => count.value * 2)

    return {
        count, // 
        increment,
        doubleCount
    }
})